import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import Welcome from '@/pages/Welcome'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Home from '@/pages/Home'
import Goods from '@/pages/Goods'
import Details from '@/pages/Details'
import Cart from '@/pages/Cart'
import Order from '@/pages/Order'
import Pay from '@/pages/Pay'
Vue.use(Router)

export default new Router({
  mode:'history',
  routes: [
    {
      path: '/',
      name: 'Welcome',
      component: Welcome, 
      meta: {
        requireAuth: false,
      }
    },
    {
      path: '/login',
      name: 'Login',
      component: Login,
      meta: {
        requireAuth: false,
      }
    },
    {
      path: '/register',
      name: 'Register',
      component: Register,
      meta: {
        requireAuth: false,
      }
    },
    {
      path:'/home',
      name:'Home',
      component:Home,
      meta:{
        requireAuth:true
      },
      children:[
        {
          path:'',
          name: 'Goods',
          component: Goods,
          meta: {
            requireAuth: true
          }
        },
        {
          path:'goods',
          name: 'Goods',
          component: Goods,
          meta: {
            requireAuth: true
          }
        },
        {
          path: 'order',
          name: 'Order',
          component: Order,
          meta: {
            requireAuth: true,
          }
        }
      ]
    },
    {
      path: '/details/:id',
      name: 'Details',
      component: Details,
      meta: {
        requireAuth: true
      }
    },
    {
      path: '/cart',
      name: 'Cart',
      component: Cart,
      meta: {
        requireAuth: true
      }
    },
    {
      path: '/pay',
      name: 'pay',
      component: Pay,
      meta: {
        requireAuth: true
      }
    }
    
  ]
})
